package amit.ad;

import amit.util.ConvertCharSets;
import amit.util.FileUtil;
import amit.util.Runner;

/**
 * Ad details in homeless howHideMessageText('174869','23');">????</TD>
 * <TD nowrap width=50px VALIGN=Top onclick="javascript:
 * ShowHideMessageText('174869','23');">1</TD>
 * <TD nowrap width=60px VALIGN=Top onclick="javascript:
 * ShowHideMessageText('174869','23');">$610</TD>
 * <TD nowrap width=140px VALIGN=Top onclick="javascript:
 * ShowHideMessageText('174869','23');">??????-????????</TD>
 * <TD nowrap width=120px VALIGN=Top onclick="javascript:
 * ShowHideMessageText('174869','23');">TEL- AVIV CENTER</TD>
 * <TD VALIGN=Top nowrap width=60 onclick="javascript:
 * ShowHideMessageText('174869','23');">?????</TD>
 * <TD ALIGN=cent
 * 
 * @author ido
 * 
 */
public class AdDetails {

	private String id;
	private String type; // dira, vila
	private float rooms;
	private int price;
	private String address;
	private String city;
	private String comments;

	public AdDetails() {

	}

	/**
	 * 
	 * @param type
	 * @param rooms
	 * @param price
	 * @param address
	 * @param city
	 * @param comments
	 */
	public AdDetails(String id,String type, float rooms, int price, String address,
			String city, String comments) {
		this.id = id;
		this.type = ConvertCharSets.getHebrewFromISO8859(type);
		this.rooms = rooms;
		this.price = price;
		this.address = ConvertCharSets.getHebrewFromISO8859(address);
		this.city = ConvertCharSets.getHebrewFromISO8859(city);
		this.comments = ConvertCharSets.getHebrewFromISO8859(comments);
	}

	
	public AdDetails(String id, String type, float rooms, int price, String address,
			String city, String comments, boolean isValHebrew) {
		if (isValHebrew) {
			this.id = id;
			this.type = type;
			this.rooms = rooms;
			this.price = price;
			this.address = address;
			this.city = city;
			this.comments = comments;
		}
		else {
			this.id = id;
			this.type = ConvertCharSets.getHebrewFromISO8859(type);
			this.rooms = rooms;
			this.price = price;
			this.address = ConvertCharSets.getHebrewFromISO8859(address);
			this.city = ConvertCharSets.getHebrewFromISO8859(city);
			this.comments = ConvertCharSets.getHebrewFromISO8859(comments);
		}
	}
	
	public String getId() {
		return id;
	}

	public String getRentUrlId() {
		return Runner.AD_DETAILS_RENT_LINK + id + ".asp";
	}
	public String getSaleUrlId() {
		return Runner.AD_DETAILS_SALE_LINK + id + ".asp";
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	public String getComments() {
		return comments;
	}

	public void setComments(String comments) {
		this.comments = comments;
	}

	public int getPrice() {
		return price;
	}

	public void setPrice(int price) {
		this.price = price;
	}

	public float getRooms() {
		return rooms;
	}

	public void setRooms(float rooms) {
		this.rooms = rooms;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String toString() {
		return"id:"+id+ " type:" + type + " rooms:" + rooms + " price:" + price
				+ " city:" + city + " address:" + address + " comments:"
				+ comments;
	}

	public String getAsCVSString() {
		return id+","+type + "," + rooms + "," + price+ "," + 
				city + "," + address + "," + comments;

	}
}
